<{include file="public/header" title='考试历史记录-'/}>
<style>
  html, body {width: 100%;height: 100%; margin: 0px;  padding: 0px; background-color: ;}
  .title{text-align: center;font-size: 15px;line-height: 40px;}
  .answerborder{border: #ccc 2px solid;border-radius:5px;padding: 2px 5px 0px 5px;}
  hr {height: 1px;/* margin: 10px 0; */ border: 0;clear: both;}
  .layui-col-md6{margin:0;border-bottom: #ccc 1px solid; padding: 3px;margin-bottom: -1px;}
  .clock{width: 100%;height: 30px;background-color: #FAEBD7;position:fixed;top:0px;left:0px;z-index:999;}
img{height: auto; max-width: 100%;}
.stuanswers img{padding: 5 0px;}
.layui-form-item{margin-bottom:5px;clear:both;*zoom:1;}
.tkempty{font-size: 100px;color: #eeeeee;text-align: center;}
.layui-form-item .layui-input-inline{float:left;width:20px;margin-right:10px;margin:2px 10px;}

</style>

<body style="padding-top: 25px;">

  <div class="layui-container" >
  	<div class="layui-row">&nbsp;</div>
  	<{empty name="myexam"}>
		<div class="layui-row"><div style="font-size: 30px;text-align: center;color: #FF5722;"><i class="layui-icon layui-icon-face-surprised" style="font-size: 100px;"></i><br><br>哎呀，没有啦！</div></div>
		<div style="padding: 15px 0px;">
	  		<div class="layui-row" >
	  			<div class="layui-col-md6" style="border:0px;">
	  				<!-- <a type="button" class="layui-btn layui-btn-fluid <{elt name='myexam[getexams][allocate][$Think.session.uid][1]' value='myexam.id'}>layui-btn-disabled<{/elt}>" href="<{:url('markpaper_previous',['id'=>$myexam.id,'eid'=>$myexam.eid])}>"><i class="layui-icon layui-icon-up"></i>上一份</a> -->
	  			</div>
	  			<div class="layui-col-md6" style="border:0px;">
	  				<!-- <a type="button" class="layui-btn layui-btn-normal layui-btn-fluid <{eq name='myaction' value='next'}>layui-btn-disabled<{/eq}>" href="<{:url('markpaper_next',['id'=>$myexam.id,'eid'=>$myexam.eid])}>"><i class="layui-icon layui-icon-down"></i>下一份</a> -->
	  			</div>
	  		</div>
	  	</div>
	<{else /}>
		<div class="layui-row title" >
		<p>试卷id:<{$myexam.id}></p>
		</div>
		<form class="layui-form" lay-filter="test1">
		<{volist name="qdata" id="vo"}>
			<div class="layui-row" style="padding: 5px 0;">
				<!-- <{$vo.sort > floor($vo.sort) ? '' : $vo.sort.'、'}><{$vo.qtitle}> -->
				<{$vo.qtitle}>
			</div>
	    	<div class="layui-row answerborder" >
	    		<div class="stuanswers">
	    			<{$myexam['answers'][$vo.qid]|htmlspecialchars_decode|default="<b class='tkempty'>空</b>"}>
	    		</div>
	    	</div>
	    	<div class="layui-row" style="margin-top: 5px;">
		    	<div class="layui-inline">
			      <label class="layui-form-label" style="width: 130px;text-align: left;color: #FF5722;padding-right: 0px;">此题人工判卷得分为</label>
			      <div class="layui-input-inline" style="width: 100px;">
			        <select name="score[<{$vo.qid}>]" lay-verify="required" lay-search class="scoreselect">
			          <option value="">选择分数</option>
			          <{for start="0" end="$vo.score" comparison="elt"}>
			          <option value="<{$i}>" <{heq name="$i" value="$myexam['score'][$vo.qid]"}>selected<{/heq}>><{$i}></option>
			          <{/for}>
			        </select>
			      </div>
			       <span style="width: 10px;text-align: left;color: #FF5722">分</span>
			    </div>
			</div>
			
		   
		
	  	<{/volist}>
	  	
	  	<div style="padding: 15px 0px;">
	  		<div class="layui-row" >
	  			<div class="layui-col-md6" style="border:0px;">
	  				<a type="button" class="layui-btn layui-btn-fluid" href="<{:url('markpaper',['id'=>$myexam.id,'eid'=>$myexam.eid,'action'=>'previous'])}>" id="previous"><i class="layui-icon layui-icon-up"></i>上一份</a>
	  			</div>
	  			<div class="layui-col-md6" style="border:0px;">
	  				<div class="layui-form-item">
	  					<button class="layui-btn layui-btn-normal layui-btn-fluid" lay-submit="" lay-filter="sub" type = "button" id="next"><i class="layui-icon layui-icon-down"></i>提交AND下一份</button>
	  				</div>
	  			</div>

	  		</div>
	  	</div>
	  	<div class="layui-row" style="margin-top: 30px;">
	    	<!-- <button class="layui-btn layui-btn-fluid" lay-submit id="select" lay-filter="answersub" type = "button">立即提交</button> -->
	  	</div>
	  		
	  	</form>
	<{/empty}>
	
  </div>
   
  








	<div style="height: 50px;"></div>
 








  
 



<{$mystartid}><{$myendid}>
<script>
//JavaScript代码区域
layui.use(['element','jquery','layer','form'], function(){
  var element = layui.element,$ = layui.$,layer=layui.layer,form=layui.form;
  $('.stuanswers img').bind('click',function(){
  	//alert($(this).attr('src'));
  	layer.open({
	  type: 1,
	  title: false,
	  closeBtn: 1,
	  area: ['auto'],
	  skin: 'layui-layer-nobg', //没有背景色
	  shadeClose: true,
	  content: '<div><img src="'+$(this).attr('src')+'" alt="" /></div>'
	});
  });
  var thisid='<{$myexam.id}>',mystartid='<{$mystartid}>',myendid='<{$myendid}>';
	if (thisid<=mystartid) {
	  	//console.log('up');
	  	$('#previous').addClass("layui-btn-disabled");
		$('#previous').on('click',function(){
			layer.msg('没有上一个啦！');
			return false;
		})
	}else{
		return true;
	}
	
	    // var d = {};
	    // var t = $('form').serializeArray();
	    // //t的值为[{name: "a1", value: "xx"},
	    // //{name: "a2", value: "xx"}...]
	    // $.each(t, function() {
	    //   d[this.name] = this.value;
	    // });
	    //alert(JSON.stringify(d));
  
	// $('#next').on('click',function(){
	// 	//alert(JSON.stringify(d));
	// 	 $.post("<{:url('do_mark',['id'=>$myexam.id,'eid'=>$myexam.eid])}>",d,function(data,status){
 //              // alert(data);
 //              // alert(JSON.stringify(data));
 //              // console(data);
 //              if(data===1){
 //                layer.msg('提交成功!',{icon: 6,time:1000},function(){
 //                   //x_father_close();
 //                   //layer.alert(myendid);
 //                   if (thisid < myendid) {
 //                   		//layer.alert('111！');
 //                   	self.location.href="<{:url('markpaper',['id'=>$myexam.id,'eid'=>$myexam.eid,'action'=>'next'])}>"+'?time='+(new Date().getTime());
                   		
 //                   		//location.reload();
 //                   } else {
 //                   		layer.alert('任务已完成！');
 //                   }
                   
 //                });
 //              }else{
 //                layer.alert(data,function(index){
 //                  layer.close(index);
 //                }); 
 //              }
 //           })
	// })

	//监听表单提交
	  form.on('submit(sub)', function(data){
	  	//console.log("ok");
	    // layer.alert(JSON.stringify(data.field), {
	    //   title: '最终的提交信息'
	    // });
	    //form.render();
        // layer.confirm('确定提交?', {btn: ['提交','取消'],icon: 3, title:'提示'}
        // ,function(index){
          //do something
            $.post("<{:url('do_mark',['id'=>$myexam.id,'eid'=>$myexam.eid])}>",data.field,function(data,status){
              // alert(data);
              // alert(JSON.stringify(data));
              // console(data);
              if(data===1){
                layer.msg('提交成功!',{icon: 6,time:1000},function(){
                   //x_father_close();
                   //layer.alert(myendid);
                   if (thisid < myendid) {
                   		//layer.alert('111！');
                   		self.location.href="<{:url('markpaper',['id'=>$myexam.id,'eid'=>$myexam.eid,'action'=>'next'])}>"+'?this='+thisid;
                   		
                   		//location.reload();
                   } else {
                   		layer.alert('任务已完成！');
                   }
                   
                });
              }else{
                layer.alert(data,function(index){
                  layer.close(index);
                }); 
              }
           })
          
        //});
	     
	    
	  });
  
  
});

</script>
</body>
</html>
